knitr::opts_chunk$set(echo = TRUE)
librarian::shelf('targets', 'tidyverse', 'glue', 'fim', 'gghutchins')
tar_load(projections)
gghutchins::set_hutchins_defaults()

The BEA frontloaded all the coronavirus relief fund grants in Q2 of 2020

projections %>%
  filter_index('2020 Q1' ~ . ) %>% 
   select(coronavirus_relief_fund)

We spread these grants over 12 quarters with 6% going out in the first quarter, 8% in the second, 10% over the last 8 quarters

 projections %>%
  filter_index('2020 Q1' ~ '2023 Q2') %>% 
   select(date, coronavirus_relief_fund, nonprofit_ppp) %>% 
   mpc_coronavirus_relief_fund() %>% 
     safe_quarter() %>% 
  safejoin::safe_full_join(fim::cares, by = 'date', conflict = 'patch') 

   pivot_longer(-c(date, id)) %>% 
   ggplot(aes(x = date, y = value, color = name)) +
   geom_point() +
   geom_line() +
   scale_color_hutchins() +
         scale_x_yearquarter(breaks = waiver(),
                          date_breaks = '3 months',
                          date_labels = "Q%q") + 
   scale_y_continuous(breaks = seq(0, 60, 10),
                                   name= 'Billions') +
      facet_grid( ~ year(date),
                  space = "free_x",
                  scales = "free_x",
                  switch = "x") +
   labs(title = 'Quarterly spending from coronavirus relief fund')


malcalakovalski/fim documentation built on July 30, 2024, 8:37 a.m.